// TOWN DIALOGUE SCRIPT
//    Town 158: Wainscotting

begintalkscript;

variables;

short i,j,k,r1,choice;

// Yar

begintalknode;
	tag = 40;
	state = -1;
	nextstate = 1;
	question = "Yar";
	text1 = "A small, depressed man sits at his desk, stitching together the torn binding of a thick, leather-bound book. He seems pleased that his library has received a visitor, but not very much.";
	text2 = "_Welcome, dirty traveler. I am Yar the Librarian._";
	text5 = "Yar carefully stitches the pages back into the book he is restoring. It's a painfully slow and painstaking process. Books are rare and valuable out here.";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_Greetings. Nice library._";
	text1 = "_Nice of you to say. I run the library of Wainscotting. Such as it is._";

begintalknode;
	state = 2;
	nextstate = 3;
	question = "_Why do you say that?_";
	text1 = "_Ah, it was a beautiful idea. Ships coming south, coming north, many staying here, most having a few books I could buy. I got books from all over and kept them here safe. Then the disaster happened._";

begintalknode;
	state = 3;
	nextstate = 4;
	question = "_What disaster?_";
	text1 = "_Plagues of monsters. Valorim was quarantined. No ships from far-away lands. No new books. Nobody wanting to see or buy the old ones. I sit here bored, waiting._";

begintalknode;
	state = 4;
	nextstate = -1;
	question = "_Don't you have some sort of hobby?_";
	text1 = "_Nope. I sit around, waiting for someone like you to come appreciate my work. Feel free to peruse the books. You're an adventurer. You may find something to interest you!_";

begintalknode;
	state = 1;
	nextstate = 5;
	question = "_Can you provide us with magical training?_";
	text1 = "Yar snorts. _What do I look like to you? I am a librarian. You can look through my books for rare and valuable works of magic. But don't count on finding anything but light fiction._";

begintalknode;
	state = 5;
	nextstate = -1;
	question = "_No books which will teach us how to cast my existing spells at a much higher level of efficiency?_";
	text1 = "_Oh, I'm sure nothing like that exists anywhere._";

begintalknode;
	state = 1;
	nextstate = -1;
	question = "_Have any maps of Valorim?_";
	text1 = "_Sadly, no. Sea charts? Yes. Land maps, no. I've heard you can buy them in the towns to the east, though. Calloc and Dorngas._";

// Abruzzo

begintalknode;
	tag = 60;
	state = -1;
	nextstate = 29;
	question = "Abruzzo";
	text1 = "A tall, brutish man runs this inn. His earrings and tattoos mark him as a former sailor.";
	text2 = "_I'm Abruzzo,_ he grunts.";
	text5 = "Abruzzo stares at you. Only those who sail the seas get his approval.";
	action = INTRO;

begintalknode;
	state = 29;
	nextstate = 30;
	question = "_What can I get here?_";
	text1 = "He spits into a rag and uses it to wipe off the counter. _I got rooms and booze. Rooms are 20 coins, for you. Booze is also 20 coins, for you. Got a problem with that?_";

begintalknode;
	state = 30;
	nextstate = -1;
	question = "_Aren't those prices a bit steep?_";
	text1 = "_Are they? I just don't care._";
	text2 = "Nice fellow.";

begintalknode;
	state = 29;
	nextstate = -1;
	condition = gf(159,11) >= 1;
	question = "_A fellow named Vagro mentioned he knows you and that you two used to be involved in some pirating. Is this true?_";
	text1 = "You ask him about Vagro. He grins. _Ah, those were the days. Looting, a little piracy. We took a bunch of our loot and hid it under a statue in this town called Greendale. Then the word got out on us, and we couldn't get it!_";
	text2 = "_I'm sure it's not there anymore. Ah, those were the days._";
	action = SET_SDF 158 11 1;

begintalknode;
	state = 29;
	nextstate = 31;
	question = "_So this village is called Wainscotting?_";
	text1 = "_Yes. Doesn't it sound like a lovely name for a village? Wainscotting. Wainscotting, Wainscotting, Wainscotting. Wainscotting._";

begintalknode;
	state = 31;
	nextstate = -1;
	question = "_Wainscotting._";
	text1 = "_Wainscotting._";

begintalknode;
	state = 29;
	nextstate = -1;
	condition = gf(158,12) == 1;
	question = "_I killed a whole bunch of bandits up to the north._";
	text1 = "_You did? Tell me about them._ You describe the evil horde you dispatched. _You done us a good deed, friend. You truly have. Those vermin have been raiding us for months._";
	text2 = "_You're welcome to stay here for free whenever you want. It's the least I can do!_";
	action = SET_SDF 158 12 2;

begintalknode;
	state = 29;
	nextstate = -1;
	condition = gf(158,12) == 2;
	question = "_I'd like a place to stay for the night._";
	text1 = "The room is cold and dirty, but it's free. After what you did for the town, Abruzzo is glad to give you shelter for the night.";
	action = END_TALK;	
	code =
		revive_party();
		relocate_char(get_pc_id(0),19,44,FALSE);
		relocate_char(get_pc_id(1),20,44,FALSE);
		relocate_char(get_pc_id(2),20,45,FALSE);
		relocate_char(get_pc_id(3),19,45,FALSE);
	break;

begintalknode;
	state = 29;
	nextstate = -1;
	condition = gf(158,12) <= 1 && coins_amount() >= 20;
	question = "_I'd like a room for the night._ Pay 20 coins.";
	text1 = "He takes the coins and gruffly shows you to a cold, dirty room. He leaves before you can complain. Resigned, you go to sleep.";
	action = END_TALK;	
	code =
		revive_party();
		change_coins(-20);
		relocate_char(get_pc_id(0),19,44,FALSE);
		relocate_char(get_pc_id(1),20,44,FALSE);
		relocate_char(get_pc_id(2),20,45,FALSE);
		relocate_char(get_pc_id(3),19,45,FALSE);
	break;


begintalknode;
	state = 29;
	nextstate = -1;
	condition = coins_amount() >= 20;
	question = "_A round of booze, please._ Pay 20 coins.";
	text1 = "You buy some acrid, oily liquor. You have to drink it quickly, before it eats its way through the mug. Your intestines scream for mercy. Reality spins madly around you.";
	code =
		force_char_status(30000,1,20);
		force_char_status(30000,2,20);
		force_char_status(30000,5,20);
		change_coins(-20);
	break;

begintalknode;
	state = 29;
	nextstate = -1;
	condition = 1;
	question = "_I don't need anything._";
	text1 = "Abruzzo silently nods.";
	action = END_TALK;